package com.neu.gulimall.thirdpart.controller;

import com.neu.common.utils.R;
import com.neu.gulimall.thirdpart.component.SmsComponent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    private SmsComponent smsComponent;

    /**
     * 提供给别的服务调用的
     * @param code  验证码
     * @param phone 手机号
     * @return
     */
    @GetMapping("/sendcode")
    public R getSms(@RequestParam("code") String code, @RequestParam("phone") String phone){
        smsComponent.sendSmsCode(code, phone);

        return R.ok();
    }

}
